%simple file open menu
%accepts path/file type
% returns file pointer fid
% er = 1 OK
% er = -1 cancelled;
% er = -2 failure in opening file

%latest date 13.10.2002

function[fid,er,file,path1]=GetBfile(s),

er=1;

if ischar(s)==1,
   msg=s;
else,
   msg='*.*';
end;

[file,path1] = uigetfile(msg, 'Open File');

 if file == 0,
    er=-1;
    fid = 0;
 else,
line1 = [path1 file];
fid = fopen(line1,'rb'); 

if (fid == -1)
   er=-2;
end;
end;

